UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '46t1ssdY4wNwx1iXp+egQuoDNjGBYG0h918pwfTpC+M=' 
WHERE 
  key_id = '3af6122a5d3402fb81f73de0ed8a29bc54083380b63a58e76c6c97b27c2d5464' 
  AND (
    token = '46t1ssdY4wNwx1iXp+egQuoDNjGBYG0h918pwfTpC+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039