UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OubiMdBd8XDMRwojpnU1F/d7P7JCGPXfLvgP/a+wnM0=' 
WHERE 
  key_id = '84fe3c31b20816292fa1332a39c2441854f7083236a5e150473b4cfe4652a386' 
  AND (
    token = 'OubiMdBd8XDMRwojpnU1F/d7P7JCGPXfLvgP/a+wnM0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032