Why my token generated from backend expires when using?

I have generated API tokens and refresh token from https://accounts.infusionsoft.com/app/central/home here.
When I am using that in my script at $infusionsoft->setToken(TOKEN);
and then call your PHP SDK method $tasks = $infusionsoft->tasks()->all();
It gives me token expire error. I just generated it. They why this is happening?

I am very frustrated using your api documentation and methods. Not able to even get access.

Even if I use script to generate token, on second request it automatically gets expired.