Writing to a custom field in PHP In Drupal 7, using the Field module, Field SQL Storage and Field UI I've created several custom user fields.  I can display them in PHP like this:

global $user;
$account = user_load($GLOBALS['user']-&gt;uid);
if ($items = field_get_items('user', $account, 'field_keys_available')) {
   $keys_remaining = $items[0]['value'];


The above example displays the custom keys_available field, a field we use to determine if the user is entitled to software license keys.  I need to decrement field_keys_available in the PHP that issues a license key to a user.  Can someone help with the syntax on this?  I've discovered fifty ways to generate white screens, but haven't landed on the right syntax.
It should be something as simple as

$account = user_load($GLOBALS['user']-&gt;uid);
$edit['field_keys_available'][LANGUAGE_NONE][0]['value'] = 'new value';
user_save($account, $edit);


The comments in the user_save() docs have some more details and examples.