scheduled account lock Mac OS X
EDIT: Although I am not certain of why cron fails to work for this specific use-case, this answer is superceeded by the (currently more correct) answer using launchd.

Use crontab -e in the terminal application to add /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend to the Crontab at the appropriate time, like so (for 5:30 PM):

30 17 * * * /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend