Don't force the mysql class to be passed in. Only useful for Unit Tests. Will lead to coupled components otherwise
Let mysql figure out if this query can be cached. It's better at it than we are
Assuming the hash is also the primary key (it should be) there is no reason to delete and then insert. Instead, an 'overwriting' insert removes the need for nasty file based locks.