UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '02roIAPht61IgjYSzv1Hi1RZob+s6lCfyQmwnZm0XGg=' 
WHERE 
  key_id = 'f01c364c35351f5e79c30dd25ed61e67ff9cb62316807b7522011a3b6c1e8e6f' 
  AND (
    token = '02roIAPht61IgjYSzv1Hi1RZob+s6lCfyQmwnZm0XGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028