I get night time anxiety on a regular basis (much less than I used to now though) and those kinds of HR numbers are normal during anxiety.
140 bpm poses no risk to your heart at all (unless you have a medical reason for it to cause an issue, which you don't)!
I have been told by more than one Doctor that your heart can withstand that for days on end, although they would like to investigate the underlying cause if it was reported to them. In your case anxiety/stress is a perfectly normal trigger, and taking 30 mins or so to come back down is normal too.
I have been to hospital a couple of times where my HR wouldn't come down and my HR was about 120bpm, but in both cases I had an infection and was fighting a lengthy and expensive legal battle and in both cases there was nothing medically wrong and I was told to 'try and relax more'........
The highest HR I've recorded during a panic attack was in the region of 160-180bpm, but even that's not dangerous in any way.
I have daytime panic under control now, and only suffer at night, and only after I've fallen asleep. All I do now is roll my eyes at the anxiety, wait for it to pass (5-10 minutes) and then go back to sleep.
It's one of those things that if you pay no attention to it, it goes away.