Fix optimistic lock to not revert incremented version.