You can expire passwords future or past (past immediately locks out new logins) but what if you and to re-enable the user – just resetting the password will not do it if you set a valid until that is in the past. In that case do this:
ALTER USER <username> VALID UNTIL ‘Jan 31 2030’;
ALTER USER <username> VALID UNTIL ‘infinity’;
if select * from pg_user return “invalid” in the valid until field – you know you did not set it correctly