UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qyn5vONwFIFTMn7flJw5X3cepYvFcKJfYaUAf3wGAZE=' 
WHERE 
  key_id = '95f44f974b28087736f0ed4d35ade41384f848c3057cdf8551679650750f298c' 
  AND (
    token = 'qyn5vONwFIFTMn7flJw5X3cepYvFcKJfYaUAf3wGAZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029