UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h1T1z280E0VKedxTWY+T89z68qBs863edic0fSKfBEc='
WHERE
key_id = '3bbafd776c4985b09ed2821ebe1ab877691f8f9dba4a3bf588f849c8394fc231'
AND (
token = 'h1T1z280E0VKedxTWY+T89z68qBs863edic0fSKfBEc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)