The default configuration for ton full node (https://github.com/ton-blockchain/ton/blob/master/validator/validator.h#L95) is to save state for 1 hour. Block related data is saved for 1 week. Both are moved to archive dir after this period. Archive dir is deleted after 1 year. This configuration can be changed and archive nodes for example will deploy their nodes with much bigger values so users can query state at anytime in history.
In order to query an old state (more than 1 hour ago) you will need to use an archive node. Using the TON APIv4, you can query
GET /block/<seqno>/<address>/run/<method>/<args?> which can be used with
method=get_wallet_data to query jetton balance.
In Toncenter for example, it is not possible to query a method from old states. However, you can use
archival=true to get all transactions and calculate the exact amount on each state.
Transactions in non archive (default) nodes will be stored for 1 week.