Issue an sql update only when values in the db have actually changed

This reduces the processing time to sync a flat folder with 1000 files with about 40%. 

Adding 1000 files: from  1.16s / file to 0.837s / file
Removing 1000 files: from 0.28s / file to 0.20s / file

(on my system update statements take about 45ms, while select statements take 0.5 - 1ms)