I would say most if not all M3s have had a good run close to the redline. These cars are designed to run all day every day at the limits from my understanding and unless it's spent a life on the track I don't think I'd be too concerned.
BMW Aust obviously sell off their ex-driver training M3s which have been thrashed on tracks around the country and I've not heard of any second-hand owners whinging on this forum.
I'd look for the usual body damage repair and excess mileage. To be honest, the engine would be the last of my concerns if I was in the market - so long as it's not a private sale.
2012 BMW F10 520d M-Sport
2010 BMW E70 X5 xdrive40d