UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U9sWUrx3dKz3VAxnLqnYO8jvqjNiaua5yTqLODh8NpI='
WHERE
key_id = '15129f9034ca3dd8bb035f470aa239d6b3954bb8d8fc254991a726d3257dd823'
AND (
token = 'U9sWUrx3dKz3VAxnLqnYO8jvqjNiaua5yTqLODh8NpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)