hope you are well.

I have a table in a MySQL (MariaDB) database with the below schema:

```
CREATE TABLE `scheduled_immobilise` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `account` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `device` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `allow_from` time DEFAULT NULL,
  `allow_to` time DEFAULT NULL,
  `active` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL,
  `last_updated` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `cron_id_from` int(11) DEFAULT NULL,
  `cron_id_to` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique` (`account`,`device`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

```

What I am trying to do is write a query that will either create a row (if the unique index doesn't exist), or if it already exists update it. I know you can do this by doing a select query first, but ultimately i was hoping to avoid this. Below is the SQL query I am using to create. Please note this is using PDO named placeholders..

```
INSERT INTO 
    scheduled_immobilise (
        account, 
        device, 
        allow_from, 
        allow_to, 
        active
    ) 
VALUES (
    :account, 
    :device, 
    :allow_from, 
    :allow_to,
    :active
)

```

Any help is much appreciated, thanks in advance!

Paul.