it might not be doable in windows..
accroding to this >>
http://php.net/manual/en/function.flock.php it can't be done on Windows.
"By default, this function will block until the requested lock is acquired; this may be controlled (on non-Windows platforms) with the LOCK_NB option documented below."
Why don't you use something like sqlite?