https://en.wikipedia.org/wiki/Deferred_gratification
https://en.wikipedia.org/wiki/Stanford_marshmallow_experimen...
It's not mentioned in those articles, but one of the differences in those who didn't eat the marshmallow was that they used coping strategies to distract themselves. Things like singing to themselves, looking around the room, or drumming on the table. I think I recall a follow-up experiment that's not mentioned in those articles where they taught these coping strategies to a group of children then ran the experiment and, sure enough, far more of them were able to resist eating the marshmallow than in the control group.