SQLite Forum

adding record if it doesn't already exist
Login
If the INSERT OR IGNORE fails because any UNIQUE indexes would be violated, nothing changes.
If the INSERT OR IGNORE does not fail, all fields defined in the command are changed.

In other words, this does what you seem to want.