Considering your age,its more likely to be palpitations which can be anxiety
related,medicine related or due to excess of caffeine. It can also manifest with thyroid overactivity,which we call hyperthyroidism
.The heart reacts to high levels of thyroid hormone with rapid beating, usually irregularly and may just remain for a few minutes or hours but can sometimes become persistant as well.This is Atrial Fibrillation/Atrial Flutter
, which is quite a common condition but poorly picked up.
I would advise you to ask your doctor to rule out any such 'organic' conditions before we conclude it to be anxiety/caffeine induced.
Tests like Holter Monitor(24hr ECG monitoring tape), Event Recorder, ECHO of the heart and not to forget Thyroid function testing would be the way foward from here.
Your doctor would be able to give you more insight into this.