How far in advance do you need to purchase HE tickets to get the discount? 90 days? 60 days?
Currently 30 days minimum for an Advance ticket.
... but what even the Heathrow Express website doesn't tell you is that between 14 and 30 days in advance there is a 2nd tier of discount at £22.
So only within 0 to 14 days do you pay the full fare.
Maybe worth mentioning, while many immediately think "Heathrow Express", it really is only useful if you are going to Paddington, or staying near there. The Elizabeth line (which also stops at Paddington) goes further into the city, and of course the Piccadilly Line is much better for Hammersmith, Baron's Court, Kensington, Victoria Station area and the South Bank.
It is not a legal requirement to enter London from LHR at Paddington Station so you may have better options depending on your final destination.