As you didn't go into technical details about the technology stack and OS you use I will answer your question theoretically.
You have multiple approaches. One of them is to set up a cron task:
- Create a procedure on MySQL server and save
- Using any serverside programming language create an executable file with a code that executes the function on MySQL DB. Based on OS you use it might be shell or batch script as well.
- Set this script as a cronjob
Take a look at the answers to this question:
Run a mySQL query as a cron job?
Another way might be to create a MySQL event.
Read about MySQL events here: https://t.ly/wmvqv
And here is the comparison of these two options:
Cronjob or MySQL event?