Clanking sound from engine

I have a 2001 black Camaro Z28 (automatic) that I don’t drive very much (42,000 miles) and it’s in pretty good shape. I have no problems driving it when it’s cold, but as far back as I can remember when its warm (after driving for about 30 minutes) the car seems to have 1/2 its power when going from 30 to 40 mph. When I floor the accelerator at this point, I hear a loud “clanking” from the engine. After passing 45 mph, it seems fine. Any ideas what’s going on?

The “clanking” may be engine knock (ping). It might be fuel octane too low, carbon build up in the cylinders, timing too high (advanced).