You could insert a time with time().
That is a UNIX-timestamp.
When you want to select the records that are added in the last 5 minutes you do this:
$time = time()-300;
$query = "SELECT * FROM msglog WHERE time > $time";
300 seconds = 5 minutes 😉
I hope this it what you mean?