Quasars as standard candles II. The non-linear relation between UV and X-ray emission at high redshifts