Walter Mischel ran a series of famous experiments in the late 1960s where he tested the ability of children to control their impulse for immediate gratification. He simply put them in a boring office with a marshmallow or Oreo sitting on a plate. The kids were told that if they did not eat it that they would get another marshmallow / cookie in 15 minutes. Below is a short video of the experiment.
At the time, Mischel surmised that the kids who ate the marshmallow immediately or soon after the clock started running were unhappy at home and had behavioural difficulties. However, he also tracked his 653 subjects over time and found that the kids who were unable to control their need for gratification performed very poorly in school relative to those who delayed their need for gratification. They also underperformed in later life. You can read more here.
Why did Mischel find what he did? One possibility is that kids who ate the marshmallow quickly grew up in unstable and untrustworthy environments and that their instant gratification simply reflected growing up in such an environment (click here). This instability meant that they were also reluctant to invest in their human capital i.e., education. Indeed, instant gratification is rational and optimal if one lives in an unstable environment.