Yes, I don’t exactly understand the workflow, the use case. If I had to update some token, then I would check this when the page is loaded and the current user’s token’s expired, then run this and that to update the token. Or only when this particular token is required.

The Do when the condition is true is also applicable here, however, there are indeed various ways to do things. From a backend perspective, the database trigger seemed the best way out here, as you want to do sth right after sth changes.