Support optimistic locking.

Based on https://github.com/MongoEngine/mongoengine/pull/276.
Merge pull request #3 from lyft/master-lyft-add-optimistic-locking

Support optimistic locking.