UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cMg4NSoPMHwvN+hiIENbWgyu3gWc0b6CTADWpNuXtMg='
WHERE
key_id = '496e791711a1ca3c00309e81fe783d5c21f5986fa6af4c22b99a5b80cb8efa5e'
AND (
token = 'cMg4NSoPMHwvN+hiIENbWgyu3gWc0b6CTADWpNuXtMg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)