Fixes bug where the pua db elements were deleted too early.

The problem is that the update_db function was deleting elements
10 seconds before they are expired and before the expire time could
have been extended by the same function.

This patch fixes the order of update and delete operations:
1) Update the expired elements (and other changes)
2) Delete expired elements after the possible update

This allows only deleting elements that are really expired.
RPM spec: added dependencies for mysql and postgresql libs
Merge pull request #130 from dsandras/ds-pua-dbupdate-fix

Fixes bug where the pua db elements were deleted too early.