UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SWC3156Hz33BAAN8M/3nJn0T3pjf1P7xSpufojRgQSc=' 
WHERE 
  key_id = '4fc2389dd2828cc87470d284e3537473130f65516e9824765bf1d408d025511f' 
  AND (
    token = 'SWC3156Hz33BAAN8M/3nJn0T3pjf1P7xSpufojRgQSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030