How to get player steam id?

No a Steam ID is unique / steam account and it will not change. To identify a player use: FUniqueNetIdRepl / FUniqueNetIdSteam. So the UniqueId will give you the SteamID.
I think it has a ToString method according to the code it returns a 64bit integer in an FString. Convert it back to uint64_t then you can use it for database queries.

GitHub Code:
https://github.com/EpicGames/UnrealEngine/blob/c9f4efe690de8b3b72a11223865c623ca0ee7086/Engine/Source/Runtime/Online/OnlineSubsystemSteam/Private/OnlineSubsystemSteamTypes.h