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