UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6aB2lrCb9rftLBFFAxrMVW8acwsBH1VPaoMq0oewiVQ=' 
WHERE 
  key_id = '3d9d8ac962d826ba2d2327fdc5e5e1900d97888cd6301055b410d66cdd5bf309' 
  AND (
    token = '6aB2lrCb9rftLBFFAxrMVW8acwsBH1VPaoMq0oewiVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032