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