UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b4dFJF+6ooRAtQ31BwDUEyCoGoQJkKhhqYRhUXJBpy4=' 
WHERE 
  key_id = '969d4c86f1a1f2d12793ed8a1902939a60ed4a0051da59bb04e59c49ccd8a20b' 
  AND (
    token = 'b4dFJF+6ooRAtQ31BwDUEyCoGoQJkKhhqYRhUXJBpy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042