UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cz7Khat9Dq1E+1AkbARO0Bk9oXj8THdOuSHietlZvrs='
WHERE
key_id = 'cf67696e262196daef1d0e24bb3c4b4b21faa3d38464e374af61cf92a6d1c11d'
AND (
token = 'cz7Khat9Dq1E+1AkbARO0Bk9oXj8THdOuSHietlZvrs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)