UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aL1pXzSb348ONo4guoh96y8QBaSjPJ8aGVmtF1ZlWPo='
WHERE
key_id = 'b04865a80225d2279fc151728abab0aa2df74100844e4322561db2b1f241398a'
AND (
token = 'aL1pXzSb348ONo4guoh96y8QBaSjPJ8aGVmtF1ZlWPo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)