remove my previous stuff, cause it seems not working , i re-write it for another post :
Query for non-used accounts
after have the output file, you should run some command to extract only account name , and run
zmprov ma account@domain zimbraAccountStatus locked
for the accounts.