Identity uses a token cache. in particular you are interested in a distributed cache.
https://learn.microsoft.com/en-us/entra/msal/dotnet/how-to/token-cache-serialization?tabs=aspnetcore
Microsoft supplies an implementation using Resdis, SQL Server and NCache:
https://learn.microsoft.com/en-us/aspnet/core/performance/caching/distributed?view=aspnetcore-9.0
the sqlserver cache (nuget package):
I could not find an open source sql cache. AWS uses either Redis or its managed sqlserver option.
here is the sqlserver Cache source. you could port to another database:
https://github.com/dotnet/aspnetcore/tree/main/src/Caching/SqlServer
note: another common approach is to just store the token in a cookie.