UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L7c6QdB3nOlWDwUbub6QaMk0m7QjBq7Oa2ThS4lGo00='
WHERE
key_id = 'e27ac21f36c48384c42a44ec080da53238639854087e3def25bf10d414bb3d0b'
AND (
token = 'L7c6QdB3nOlWDwUbub6QaMk0m7QjBq7Oa2ThS4lGo00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)