Only set CAS on success

Change-Id: Idf619f02edbc7c70722bda5598249f37d737a517
Reviewed-on: http://review.couchbase.org/29061
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Volker Mische <volker.mische@gmail.com>