Looking for a way to callback my API after user logs out

Hi, I am new with Keycloak. I have a question regarding logout event. Is there a way to send a callback to my API after user logs out? I need to set some values in my DB before user logs out. Also, does someone has a proposition on what should I do if user token expires or user closes the tab or the browser? In that case, user wouldn’t click the logout button, and I cannot track these events, so I can send this callback to change values in my DB.

Maybe there is a solution where Keycloak can call API when the user token expires?

Thanks in advance