UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZcUJVUWSn0AOatfezV0TeBiarYJhSFhRhu6QtMh91+4='
WHERE
key_id = 'e1ad8fef9473d8e8d5bedd7e8bf8cb6e676a2c0d33280a70442da73039701345'
AND (
token = 'ZcUJVUWSn0AOatfezV0TeBiarYJhSFhRhu6QtMh91+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)