UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jcKpKYa0DCuWi7AnPF5SNnffh7hbgollhf3AQUQ+dVc=' 
WHERE 
  key_id = 'b1814d07f4f93a4f60c83f4ae2fcb0559228cf9771f1c9db4714d478eea5bced' 
  AND (
    token = 'jcKpKYa0DCuWi7AnPF5SNnffh7hbgollhf3AQUQ+dVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032