UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'urjymcDX73wk9d7teHSkaEO4lJD6amt58LKrT733OaE=' 
WHERE 
  key_id = '7c30320d722c8343d9d25d7ffd669f928b6149cc682e41f26a78e412f0abaf48' 
  AND (
    token = 'urjymcDX73wk9d7teHSkaEO4lJD6amt58LKrT733OaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036