UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VWUUCAk584C8wt/YPMdTH5ahtmaLvgs130dGs0y1IR4='
WHERE
key_id = '766919bea830ab266414421affa4491e38fbc5f5561dea2d53a4f8b5ea916d9f'
AND (
token = 'VWUUCAk584C8wt/YPMdTH5ahtmaLvgs130dGs0y1IR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)