UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ImiyPjDGN8bsxugfSxd2PVXmzcGcQhANh9U/7rM0zaM=' 
WHERE 
  key_id = '7f463f15bf901acfefaae48663039abfafe1a3faa18ab9a46569588466394a69' 
  AND (
    token = 'ImiyPjDGN8bsxugfSxd2PVXmzcGcQhANh9U/7rM0zaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033