Aims. We constrain a hypothetical variation in the fundamental physical constants over the course of cosmic time. Methods. We use unique observations of the CO(7-6) rotational line and the [C i] 3 P 2 − 3 P 1 fine-structure line towards a lensed galaxy at redshift z = 5.2 to constrain temporal variations in the constant F = α 2 /μ, where μ is the electron-to-proton mass ratio and α is the fine-structure constant. The relative change in F between z = 0 and z = 5.2, ΔF/F = (F obs − F lab )/F lab , is estimated from the radial velocity offset, ΔV = V rot − V fs , between the rotational transitions in carbon monoxide and the fine-structure transition in atomic carbon. Results. We find a conservative value ΔV = (1±5) km s −1 (1σ C.L.), which when interpreted in terms of ΔF/F gives ΔF/F < 2×10 −5 . Independent methods restrict the μ-variations at the level of Δμ/μ < 1 × 10 −7 at z = 0.7 (look-back time t z0.7 = 6.4 Gyr). Assuming that temporal variations in μ, if any, are linear, this leads to an upper limit on Δμ/μ < 2 × 10 −7 at z = 5.2 (t z5.2 = 12.9 Gyr). From both constraints on ΔF/F and Δμ/μ , one obtains for the relative change in α the estimate Δα/α < 8 × 10 −6 , which is at present the tightest limit on Δα/α at early cosmological epochs.