using keys to identify locks + removing locks

just some thoughts:

1. if data[$key] is already locked prevent overwriting it even if new_value === old_value
2. remove own lock (if set) on $key removal

in the original version we could repeatedly call set('mykey', 'myvalue', true) and we would end up with a $lock array containing more than 1 element for the same locked key : array('mykey', 'mykey',...).

please verify, kind regards