UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A6H6qVw2wmytO+1c/bCujZYK05ri7T4knF7mwvsaTJs='
WHERE
key_id = 'c7debb643b97d91ebd8b01c037a2cbaa254a0972f43091c02da77d66dc649ae7'
AND (
token = 'A6H6qVw2wmytO+1c/bCujZYK05ri7T4knF7mwvsaTJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)