UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XCY+E33OwG9fBYHpdY+ayHr1aNNailSpmsfoZSmV3Nw='
WHERE
key_id = '06d8fe0e79f51b287808c61a3268bcaed443fec226a5cf192e217467f7fd0c44'
AND (
token = 'XCY+E33OwG9fBYHpdY+ayHr1aNNailSpmsfoZSmV3Nw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)