UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hYog9RbuEWLWsY15ZWpNGjXk+WZDf8mFR8h/mmXUCvU=' 
WHERE 
  key_id = '8f166e8f75f35eb5b7a1d7b4e22af838586ed5c40bd84d500df47bb90b813183' 
  AND (
    token = 'hYog9RbuEWLWsY15ZWpNGjXk+WZDf8mFR8h/mmXUCvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016