I found the solution of my problem, in php.ini the variable session.gc_maxlifetime
was set to 1440. This setting specifies the number of seconds after which data will be seen as 'garbage', so after 24 minutes my session was invalidated.
After setting it to 2592000 (30 days) the issue was solved, I hope this will help someone.