@florent, I had to do the same for Xen Orchestra Community Edition. In my case, config.toml already contained the [authentication] section, so adding a separate config.tokenValidity.toml file did not work.
Instead, I had to modify the existing config.toml located at /opt/xo/xo-server.
In my opinion, it is best to keep defaultTokenValidity set to 30 days as a fallback in case no value is specified. You can then simply increase maxTokenValidity to the duration you prefer.
[authentication]
defaultTokenValidity = '30 days'
# default value of 0.5 years
# comment out and increase to 5 years
#maxTokenValidity = ' 0.5 year'
maxTokenValidity = '5 year'