UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZoGcZw8Mat7ox4Ab/OOSpOLpZ12vaUbuUAAGIn5KH64='
WHERE
key_id = 'b23f9589ba2191f684c7f423dca45804ae5801d21f19e6861afc5dead79c7751'
AND (
token = 'ZoGcZw8Mat7ox4Ab/OOSpOLpZ12vaUbuUAAGIn5KH64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)