UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZA8FhNvab3PIPieF2n0PYSyi3Bde7xc6k13FKN+S9HM='
WHERE
key_id = 'f9660a9359c18748006fa35a175189c73ff58abd242c470f661d65cd3a0cbd9d'
AND (
token = 'ZA8FhNvab3PIPieF2n0PYSyi3Bde7xc6k13FKN+S9HM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)