UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XWyO0ffBwLeQJfWyGrq5dqZgkX4yo92cwXOFA6wu0wU='
WHERE
key_id = '359c085dd5a500d8422514c923ec46fbf39074454f7663c327e13b85e012c209'
AND (
token = 'XWyO0ffBwLeQJfWyGrq5dqZgkX4yo92cwXOFA6wu0wU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)