UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lMPsZRxJVzfk4kT88ojb7/qfofc0lp8kyJMHX8GItY8=' 
WHERE 
  key_id = 'b3b878fc0135753f49e7aac2ddbd17ee546912efd535511037f7e005749d16c1' 
  AND (
    token = 'lMPsZRxJVzfk4kT88ojb7/qfofc0lp8kyJMHX8GItY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041