UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zQ8ETZDw1FcVvOw5vXHiLc6lJ306V78DPx17f7oHP10='
WHERE
key_id = '354d4b38ed64792cf7f87bb711b4647daed5c6222fd80d6fcda41c27dc64c757'
AND (
token = 'zQ8ETZDw1FcVvOw5vXHiLc6lJ306V78DPx17f7oHP10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)