Support optimistic lock.

#257