API token expires - how to keep it refreshed?

I need to create API poller for testing connection on an external URL. I use BASIC AUTHENTICATION with username and password to get token which I apply as BEARER TOKEN to connect to bit modified URL and retrieve necessary data. The problem is the token I'm using is valid for 3600 seconds - then I get data I wanted. But when access_token expires I must get new token. 

When getting access_token I'm getting refresh_token as well but I cannot use it to refresh API poller connection. It must be any method to keep API poller working longer then 1 hour, I guess. Any idea how to fix it?