Enter this in script editor:
on idle
try
tell application "Keychain Scripting"
set KeyName to the name of the current keychain as string
if locked of keychain KeyName is true then
return 60
else if locked of keychain KeyName is false then
tell application "System Events"
set prog_list to (get name of every process) as list
repeat with i from 1 to (count of items in prog_list)
if item i of prog_list contains "ScreenSaver" then
tell application "Keychain Scripting"
lock keychain KeyName
return 60
end tell
end if
end repeat
end tell
return 20
end if
end tell
on error
display dialog "An error has occured in Keychain Locker" buttons ¬
{"Quit"} default button 1
if the button returned of the result is "Quit" then
tell me to quit
end if
end try
end idle
I also set it as a startup item. I've been using it for weeks and have had no problems. And even at its worst, it takes no more than 2.5% of CPU on my 800 Mhz G4 iMac. Hopefully this can help others who are looking for this functionality.

