Find Locked Accounts

select li.account_id, a.username, li.failed_logins, li.last_attempt_ip
from ores.login_info li
join ores.accounts a on a.id = li.account_id
  and a.valid_to = '9999-12-31 23:59:59'::timestamptz
where li.locked = 1;

Emacs 29.3 (Org mode 9.6.15)