UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M/I7o95gwcc3o0Zbm+v4+RssA0rAO2YD+TXyqabW1ec=' 
WHERE 
  key_id = '832f92ade3f96d42aae250e80e88ec89c555d8b8cf6bcce37c5d7e1b3fdb5f02' 
  AND (
    token = 'M/I7o95gwcc3o0Zbm+v4+RssA0rAO2YD+TXyqabW1ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032