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