UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fVYn6gIhHOu8lbHWiCrXf1fLWOIuGEcDzr7o8kVXmlU=' 
WHERE 
  key_id = '82df82c2bf406f8696f715c165ada296bfd85223d8f0ed20fa8de63bfb01f65e' 
  AND (
    token = 'fVYn6gIhHOu8lbHWiCrXf1fLWOIuGEcDzr7o8kVXmlU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023