UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gGGFUCcE107psDjQBfkaTHuMZHUQT0JBmI6nXwTylcM=' 
WHERE 
  key_id = 'e974721fa836d45f67aece0ec2027993e4aa4c3f0de97488f551c255bea62675' 
  AND (
    token = 'gGGFUCcE107psDjQBfkaTHuMZHUQT0JBmI6nXwTylcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043