I would look first to this problem from a users UX/UI view.
When I am the user and know that the form gets updated only every 5 minutes, I would prefer to have an explicit refresh button that will show me the exact data situation at every time that I want to know about it.
Because otherwise I never know if the data is actual to the current moment or not.
This solves also the problem to refresh the data automatically.
In case you need the functionality as described and there are no other ways, you could create a permanent table that always holds the needed precalculated data.
That information could then be shown to the user and will get updated automatically by the Servoy data broadcasting mechanism.
https://wiki.servoy.com/display/DOCS/DatabroadcastingThat table could be updated every 5 minutes with help of the Servoy Batch Processor (scheduler plugin).
In case there are several users who need to know that information, this solution should even be more efficient as it will trigger the calculation only once (server-side) every 5 minutes, instead of being triggered every 5 min by each client/user.