UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XdFVxy4zaD5bV3MVUSWmojnIMDgzqQtTzwT0WaqHebI=' 
WHERE 
  key_id = '366f30a363be91708446cc4bdf40f80774ca36de215c3218135d5b47e3ca29eb' 
  AND (
    token = 'XdFVxy4zaD5bV3MVUSWmojnIMDgzqQtTzwT0WaqHebI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044