Backport #2567 OC_DB:insertIfNotExist()

Did a PR because I had to backport manually
@LukasReschke @bartv2