Creating personal access token through CLI

As mentioned in the following [page] Personal access tokens | GitLab) I’m looking for creating the PAT through CLI (programmatically) and having the expiry date of the token set to as min as possible (eg., less than or equal to 6 hour).

gitlab-rails runner "token = User.find_by_username('<user>').personal_access_tokens.create(scopes: ['read_user'], name: 'create_runner_pat', expires_at: 1.days.from_now); token.set_token('token-string-here123'); token.save!"

questions:

  1. When i set the expires_at value to 6 hours from_now it throws me an error. Can someone please confirm if it;s possible to set this value in hours?
  2. Also how we can generate the token.set_token string ? Any random string works here ?