"KEYS *" will return the list of key names to the client, then the client can iterate over the list, sending a command for each key (perhaps 'TTL keyname' or 'EXPIRETIME keyname').
My suggestion to the original poster is an echo of the warning message found in the description of the KEYS command at:
https://redis.io/commands/keys
It may ruin performance when it is executed against large databases.
This command is intended for debugging and special operations,
such as changing
your keyspace layout.
Don't use KEYS in your regular application code.
If you're looking for a way to find keys in a subset of your keyspace, consider
using SCAN or sets.