UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'COHcfsRa+thXtUsNFDxGSjK0+7tb4J7Y9U+fXoDdzPc=' 
WHERE 
  key_id = '2de8ae396979901a54a0e5511a077865b7279364d3039039057822611492f838' 
  AND (
    token = 'COHcfsRa+thXtUsNFDxGSjK0+7tb4J7Y9U+fXoDdzPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039