Lock a Field Instance
I was able to use a snippet from dropbucket to lock and unlock fields. I used the snippet in the devel execute php window but it could certainly be coded into a function instead:

/*
# You can use Devel Module to unlock/lock a existing field where you would otherwise get an error like "The field xxxx is locked and cannot be edited."
# Change the 'xxx' on line 1 with the machine readable name of your field.
*/
$field_name = 'xxx';
$field = field_read_field($field_name);
$field['locked'] = 1; //change this to 0 to unlock a field
field_update_field($field);