UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c6SiNCBs5prS82FFiVJfsbywlNCZuSar0p3azhJm7k4=' 
WHERE 
  key_id = 'd82c96be87bb885d1653c117bb96e694f3570083f34383e48af7536089439af4' 
  AND (
    token = 'c6SiNCBs5prS82FFiVJfsbywlNCZuSar0p3azhJm7k4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042