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