UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QyKZdzMag22VtMJKjYIu0oiHzt+OSPJospyj6wHum5s=' 
WHERE 
  key_id = '13d9099d6be87413282dec92d8dfea407133f466d975f3660f86ec6b169993d6' 
  AND (
    token = 'QyKZdzMag22VtMJKjYIu0oiHzt+OSPJospyj6wHum5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016