I used to do this for DS when he was in school and was having a hard time focusing on homework. We'd get those tubes of mini M&Ms, and I'd give him a few periodically while he was working.

I should try that again, now that we're homeschooling.

I do think it requires some self-discipline not to scarf down the entire bag midway through the task, which is another issue altogether.