Whatever price you pay, go ahead & overhaul.
Chain yes
Sprockets probably are ok
All rubber - tyres, seals, gaskets, pipes/tubes, etc
Replace the pump if/when it dies
If you end up less than 40k all in, you won’t regret it. But make sure you’re buying to ride and enjoy, not to make money.