Here is a template for a simple Timed Buff system. You can put (most of) that code somewhere in the root of your entity's Lua code. It may seem like a lot of code, but most of it is boilerplate code, to make sure your buffs aren't applied multiple times and their changes don't persist through save/load. Read all the code-comments thoroughly, so you understand how it works and how to use it. It works by applying some code immediately to apply the buff, and then setting up some code to be cal