UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KC9L450aXsOBs1uXEFdLYO3KgHLbictuSlRsKRW9EwI='
WHERE
key_id = '0dbd7d977b27a6d525b21c69f1d73f44c2e766df79296abf358674ef5aa5ed6c'
AND (
token = 'KC9L450aXsOBs1uXEFdLYO3KgHLbictuSlRsKRW9EwI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)