UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6c6krlh9xzVfRlPiuZ77Fw47AmzzpVxykKeu5nQfvfs='
WHERE
key_id = 'a9253c82c27164fa915b8c2dcbf36a1b3115a71b3fec099dee03351319cf87b5'
AND (
token = '6c6krlh9xzVfRlPiuZ77Fw47AmzzpVxykKeu5nQfvfs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)