Although flux variability is one of the defining properties of accretion flows onto supermassive black holes, its dependence on physical parameters such as the mass of the compact object and the Eddington ratio remain under discussion. In this paper we address this issue using the structure function statistic to measure the variability at X-ray wavelengths of a sample of optically selected QSOs with available black hole masses and Eddington ratios. We present a new Bayesian methodology for estimating the structure function tailored to the Poisson nature of the X-ray data. This is applied to 15,548 SDSS DRQ16 QSOs with repeat observations in the XMM-Newton archive and/or the SRG/eROSITA All Sky Survey. The X-ray structure function monotonically increases to time intervals of about 10-15 years, suggesting a preference for scenarios in which instabilities of the accretion disk contribute to the X-ray variability on long timescales. Additionally, there is evidence that the amplitude of the stochastic X-ray flux variations rises with decreasing black hole mass and Eddington ratio. This finding imposes stringent constraints on empirical models of Active Galactic Nuclei variability derived from local samples, emphasizing the significance of high-redshift population studies for comprehending the stochastic flux variations in active black holes.