If it's Mounjaro, no, it must be kept at fridge temp before use. So up to 48 hours in transit with icepacks and insulation would be ok, any longer and it will probably get too warm.
Wegovy, there was a recent change that allows it to be up to 30 degrees for 2 days whilst in transit.
The risk in pens getting too warm is that the medication may start to break down and be less effective/ineffective and possibly cause a skin/site reaction on injecting. There is also the risk of bacterial contamination - that is unlikely with an unopened pen, but the manufacturers can't guarantee it if the pens aren't stored to guidelines.
If the medication breaks down a lot, it will have visible clumps, particles or strands in it and should not be used.
In reality if this was me, I would collect the pen as soon as I could and put it straight into the fridge. As long as it didn't have any visible changes, so it was still clear and without any particulates visible, then I would personally probably still use it. I would take the small risk of it being less effective.
What I would not ever do is store an unopened pen at room temp.