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

Query time 0.00022