UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XbXaLzEWWCvM2+FCclwd9rd2ailtPVzFJEO3MwzPWRg='
WHERE
key_id = 'b9f1d647fe63e65147a22fb9a795061cac1af86711f23c6bacbaa5e6e1ab2ddc'
AND (
token = 'XbXaLzEWWCvM2+FCclwd9rd2ailtPVzFJEO3MwzPWRg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)