Oracle 11g - Database Job About User Lock
create or replace procedure p1 as
begin
  for u in (select username from dba_users where account_status in ('EXPIRED', 'EXPIRED(GRACE)') and username not in ('SYS', 'SYSTEM', '...'))
  loop
    execute immediate 'alter user &quot;' || u.username || '&quot; account lock';
  end loop;
end;
/

For 12c and higher you could use the ORACLE_MAINTAINED='N' for filtering the built-in users instead of the IN-list.