UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q4re70cW8e2h1oNImtUFP02vmHL5VENaFmWR4++rB04='
WHERE
key_id = '50f178573a32d4751594d3d528ee940a7757596c166e39251e24daa758997288'
AND (
token = 'Q4re70cW8e2h1oNImtUFP02vmHL5VENaFmWR4++rB04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)