UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LfFtUHgwdjWw0/bTCyf1zYC4eSDm68VMyjKPAlyj6Bg=' 
WHERE 
  key_id = '8e429600ecb9be96291942131521f0f3b64533d1efdc0ff773b2de9d3b8b7633' 
  AND (
    token = 'LfFtUHgwdjWw0/bTCyf1zYC4eSDm68VMyjKPAlyj6Bg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058