Replace lock with NDB transactions

Fix https://github.com/GoogleChrome/webrtc/issues/292

nit: can we have all the ndb methods grouped together at the top of the file?