You can implement such a linearizable compare-and-set operation
First you write a message that will trigger a write only if the previous value is null. Then you wait until you see your message in the queue. When you do, you sk for all the messages that have the same event you just did. If the first message you receive is yours you can send the success essage back to the client.