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