For what it's worth, I have an application where the "client.cas(key, counter+1)" which has worked for years, and it practically a direct copy of Guido's code on the page below, is suddenly failing in the past few days.
I've debugged the code extensively. It isn't that complex. But something certainly changed on App Engine.
I've tried variations of setting the initial value.
I've tried cas_reset().
I've tried flushing the cache just before the request.
"client.cas(key, counter+1)" is simply returning False every time during the while True loop, eventually timing out after 30 seconds.